<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>thymeleaf template</title>
</head>
<body>
<div style="width: 500px; height: 100px; border: 1px red solid;">
    <span th:text="${person.name}">姓名</span>
    <br>
    <button th:onclick="'getName(\'' + ${person.name} + '\')'">获得名字</button>
</div>

<script th:src="@{jquery-3.3.1.js}" type="text/javascript"></script>
<script th:inline="javascript">
    var person = [[${person}]];
    console.log(person.name + "/" + person.age);

    function getName(name) {
        console.log(name);
    }
</script>
</body>
</html>